package com.czie.myapplication;

import android.content.Intent;
import android.util.Log;

/**
 * onCreat by cs on 2021/6/9
 * 自定义广播发送者
 */
public class BroadcastSender {
    public static String BROADCAST_ACTION = "send";
    Intent intent = new Intent();

    public void send(String name, String value) {
        intent.setAction(BROADCAST_ACTION);
        intent.putExtra(name, value);
        MyApplication.getmContext().sendBroadcast(intent);
    }

    public void send(String name, boolean value) {
        intent.setAction(BROADCAST_ACTION);
        intent.putExtra(name, value);
        MyApplication.getmContext().sendBroadcast(intent);
    }

    public void send(String name, int value) {
        intent.setAction(BROADCAST_ACTION);
        intent.putExtra(name, value);
        MyApplication.getmContext().sendBroadcast(intent);
        Log.e("Send", "name = " + name + "  ,value = " + value);
    }
}
